simulate generates simulations of the state and measurement processes.
"simulate"(object, nsim = 1, seed = NULL, params, states = FALSE, obs = FALSE, times, t0, as.data.frame = FALSE, include.data = FALSE, ...)pomp.nsim times ncol(xstart).
  seed.
    the random seed to use.
    The RNG will be restored to its original state afterward.
  params is not given, then the contents of the params slot of object will be used, if they exist.
  times specifies the times at which simulated observations will be made.
    t0 specifies the start time (the time at which the initial conditions hold).
    The default for times is is times=time(object,t0=FALSE) and t0=timezero(object), respectively.
  as.data.frame=TRUE, the results are returned as a data-frame.
    A factor variable, sim, distinguishes one simulation from another.
    If, in addition, include.data=TRUE, the original data are included as an additional simulation.
    If as.data.frame=FALSE, include.data is ignored.
  pomp.nsim times ncol(xstart).
  seed.
    the random seed to use.
    The RNG will be restored to its original state afterward.
  params is not given, then the contents of the params slot of object will be used, if they exist.
  times specifies the times at which simulated observations will be made.
    t0 specifies the start time (the time at which the initial conditions hold).
    The default for times is is times=time(object,t0=FALSE) and t0=timezero(object), respectively.
  as.data.frame=TRUE, the results are returned as a data-frame.
    A factor variable, sim, distinguishes one simulation from another.
    If, in addition, include.data=TRUE, the original data are included as an additional simulation.
    If as.data.frame=FALSE, include.data is ignored.
  states=FALSE and obs=FALSE (the default), a list of nsim pomp objects is returned.
  Each has a simulated data set, together with the parameters used (in slot params) and the state trajectories also (in slot states).
  If times is specified, then the simulated observations will be at times times.If nsim=1, then a single pomp object is returned (and not a singleton list).If states=TRUE and obs=FALSE, simulated state trajectories are returned as a rank-3 array with dimensions nvar x (ncol(params)*nsim) x ntimes.
  Here, nvar is the number of state variables and ntimes the length of the argument times.
  The measurement process is not simulated in this case.If states=FALSE and obs=TRUE, simulated observations are returned as a rank-3 array with dimensions nobs x (ncol(params)*nsim) x ntimes.
  Here, nobs is the number of observables.If both states=TRUE and obs=TRUE, then a named list is returned.
  It contains the state trajectories and simulated observations as above.
rprocess and rmeasure functions, respectively.
  This makes it possible for the user to write highly optimized code for these potentially expensive computations.
pompExample(ou2)
x <- simulate(ou2,seed=3495485,nsim=10)
x <- simulate(ou2,seed=3495485,nsim=10,states=TRUE,obs=TRUE)
x <- simulate(ou2,seed=3495485,nsim=10,obs=TRUE,
              as.data.frame=TRUE,include.data=TRUE)
Run the code above in your browser using DataLab